package com.shop2cn.iapi.agentproducts.service;

import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

/**
*商品详情Call
*FreeMaker Template自动生成代码
*/
public class ProductDetailsCall extends YmatouBaseCall{
	private static String opurl ="product/productDetails";
	
	public ProductDetailsCall() {
		super(EnvSetup.getSystemUrl("agentproducts_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public ProductDetailsDto getProductDetails(){
		String string = getJsonObject().get("data").getAsJsonObject().toString();
		ProductDetailsDto productDetailsDto=(ProductDetailsDto) FormatUtil.GSONToObject(string, ProductDetailsDto.class);
		return productDetailsDto;
	}
}